package com.youlian.cloud.gateway.config;

import com.youlian.cloud.common.config.CommonConfig;
import com.youlian.cloud.log.asepct.LogResponseBodyAdvice;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.web.multipart.MultipartResolver;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

/**
 * @author liuhx
 * @create 2019/08/01 17:26
 * @email liuhx@elab-plus.com
 **/
@Configuration
@EnableWebMvc
@Import({LogResponseBodyAdvice.class})
public class MvcConfigBean extends CommonConfig {

    @Bean(name = "multipartResolver")
    public MultipartResolver getCommonsMultipartResolver() {
        CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver();
        multipartResolver.setMaxUploadSize(10485760);
        multipartResolver.setDefaultEncoding("UTF-8");
        return multipartResolver;
    }
}
